﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Engine;
using Engine.Attributes;

namespace Engine.Components
{
	public class IntegerAdder3 : CompositeComponent
	{
		private IntegerAdder adder1;
		private IntegerAdder adder2;

        public InPort<int> Op1 = new InPort<int>();
        public InPort<int> Op2 = new InPort<int>();
        public InPort<int> Op3 = new InPort<int>();
        public OutPort<int> Result = new OutPort<int>();

		public IntegerAdder3()
		{
			Initialize();
		}

		private void Initialize()
		{
			this.adder1 = new IntegerAdder();
			this.adder2 = new IntegerAdder();

			// CompositeComponent.Connect(string,string) used to instantiate the links from OutPorts to InPorts
			Connect<int>(this.Op1, adder1.Op1);
			Connect<int>(this.Op2, adder1.Op2);
			Connect<int>(this.Op3, adder2.Op2);
			Connect<int>(adder1.Result, adder2.Op1);
			Connect<int>(adder2.Result, this.Result);
		}
	}
}
